//引入请求库
import http from "@/utils/http2.js";

/**
 * 设置默认货代报价单,将isDefault值设置为(1)
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function updateDefault(quotation) {
  console.log('设置默认货代报价单Request Params:', {quotation: quotation})
  return http.put(`/api/forwarderQuote/default?quotation=${quotation}`);
}

/**
 * 确认订单，生成报价单
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function updateIsConfirm(quotation) {
  console.log('设置确认货代报价单Request Params:', {quotation: quotation})
  return http.put(`/api/forwarderQuote/confirm?quotation=${quotation}`);
}

/**
 * 设置砍价退单
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function BargainRefundOrder(quotation) {
  console.log('设置砍价退单Request Params:', {quotation: quotation})
  return http.put(`/api/forwarderQuote/bargainRefundOrder?quotation=${quotation}`);
}
/**
 * 设置错误退单
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function ErrorRefundOrder(quotation,reason) {
  console.log('设置错误退单Request Params:', {quotation: quotation})
  return http.put(`/api/forwarderQuote/ErrorRefundOrder?quotation=${quotation}&reason=${reason}`);
}


/**
 * 保存货代报价单
 * @param {*} data
 * @returns
 */
export function saveForwarderQuote(data) {
  return http.put("/api/forwarderQuote", data);
}
/**
 * 查询货代报价信息和货代名称
 * @param {*} data
 * @returns
 */
export function queryForwarderQuote(data) {
  return http.post("/api/forwarderQuote/list", data);
}

/**
 * 根据报价单号查询货代报价单信息
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function getForwarderQuoteByQuotation(quotation) {
  console.log('报价单请求参数Request Params:', quotation);
  return http.get(`/api/forwarderQuote/get/${quotation}`); // 使用路径参数传递 id
}

/**
 * 后台报价详情修改货代报价单
 * @param {*} data
 * @returns
 */
export function updateForwarderQuoteByQuotation(data) {
  return http.put("/api/forwarderQuote/update", data);
}
/**
 * 查询前端货代询价信息
 * @param {*} data
 * @returns
 */
export function queryForwarderInquiryByQuoteStatus(data) {
  return http.post("/api/forwarderQuote/inquiry/list", data);
}



